<template>
  <div class="people">
    <div class="top">
      <!-- 顶部导航栏 -->
      <van-nav-bar>
        <template #title>
          {{ user.name }}
        </template>
        <template #left>
          <div class="myicon" @click="back"><van-icon name="arrow-left" /></div
        ></template>
      </van-nav-bar>
    </div>
    <div class="content">
      <div class="left"><img :src="user.photo" alt="" /></div>
      <div class="right">
        <div class="up">
          <div>
            <div>{{ user.art_count }}</div>
            <div class="txt">发布</div>
          </div>
          <div>
            <div>{{ user.follow_count }}</div>
            <div class="txt">关注</div>
          </div>
          <div>
            <div>{{ user.fans_count }}</div>
            <div class="txt">粉丝</div>
          </div>
          <div>
            <div>{{ user.like_count }}</div>
            <div class="txt">获赞</div>
          </div>
        </div>
        <div class="down">
          <div class="consit">关注</div>
        </div>
      </div>
    </div>
    <div class="admit">
      <div>认证：微软认证开发者</div>
      <div>简介：{{ user.intro }}</div>
    </div>
    <div class="middle" v-for="(val, index) in userlist" :key="index">
      <div class="userinfo">
        <div class="left"><img src="../../../assets/科比.jpg" alt="" /></div>
        <div class="right">
          <div class="username">黑马李依依</div>
          <div class="time">2018-09-08</div>
        </div>
      </div>
      <div class="title">
        <h4>用Supervisor实现进程守护。。</h4>
      </div>
      <div class="picture">
        <div class="photo">
          <img src="../../../assets/科比.jpg" alt="" />
        </div>
        <div class="photo">
          <img src="../../../assets/科比.jpg" alt="" />
        </div>
        <div class="photo">
          <img src="../../../assets/科比.jpg" alt="" />
        </div>
      </div>
      <div class="bottom">
        <div class="util">
          <div><van-icon name="chat-o" /></div>
          <div>评论</div>
        </div>
        <div class="util">
          <div><van-icon name="like-o" /></div>
          <div>点赞</div>
        </div>
        <div class="util">
          <div><van-icon name="star-o" /></div>
          <div>收藏</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getallUserList } from '../../../api/user'
import { approachUserList } from '../../../api/news'
export default {
  data () {
    return {
      user: '',
      userlist: []
    }
  },
  methods: {
    back () {
      this.$router.back()
    }
  },
  async created () {
    const id = this.$route.query.id
    const res = await getallUserList(id)
    this.user = res.data.data
    const res1 = await approachUserList(id)
    this.userlist = res1.data.data.results
  }
}
</script>

<style lang="less">
.people {
  background-color: #f7f7f7;
  height: 100vh;
  .top {
    /deep/ .van-nav-bar__content {
      background-color: #3296fa;
    }
    /deep/ .van-nav-bar__title.van-ellipsis {
      color: #fff;
    }
    .myicon {
      /deep/ i.van-icon.van-icon-arrow-left {
        color: #fff;
        font-size: 26px;
      }
    }
  }
  .content {
    display: flex;
    padding: 10px 15px;
    background-color: #fff;
    .left {
      flex: 1;
      img {
        width: 78px;
        height: 78px;
        border-radius: 50%;
      }
    }
    .right {
      flex: 2;
      margin-left: 15px;
      font-size: 16px;
      .up {
        display: flex;
        justify-content: space-around;
        .txt {
          font-size: 14px;
          color: #bab9bb;
        }
      }
      .down {
        margin-left: 50px;
        margin-top: 17px;
        width: 145px;
        height: 28px;
        line-height: 28px;
        background-color: #6bb5ff;
        text-align: center;
        color: #fff;
        border-radius: 3px;
      }
    }
  }
  .admit {
    margin-top: 5px;
    padding: 10px 15px;
    font-size: 16px;
    background-color: #fff;
  }
  .middle {
    margin-top: 5px;
    background-color: #fff;
    .userinfo {
      display: flex;
      align-items: center;
      font-size: 16px;
      padding: 10px 15px;
      .left {
        img {
          width: 36px;
          height: 36px;
          border-radius: 50%;
        }
      }
      .right {
        margin-left: 5px;
        .username {
          font-size: 14px;
        }
        .time {
          margin-top: 3px;
          font-size: 12px;
          color: #999;
        }
      }
    }
  }
  .title {
    padding: 10px 15px;
    font-weight: normal;
    font-size: 16px;
  }
  .picture {
    padding: 0 15px 10px;
    display: flex;
    .photo {
      margin-right: 2px;
      img {
        width: 100%;
      }
    }
  }
  .bottom {
    display: flex;
    font-size: 16px;
    justify-content: space-around;
    .util {
      padding: 10px 20px;
      display: flex;
    }
  }
}
</style>
